MOD = 10

MX = 100_000

f, invF, p2, p5 = [0] * (MX + 1), [0] * (MX + 1), [0] * (MX + 1), [0] * (MX + 1)


def init():
    f[0] = 1
    for i in range(MX + 1):
        x = i
        e2 = 0
        while x & 1 == 0:
            x >>= 1
            e2 += 1
        e5 = 0
        while x % 5 == 0:
            e5 += 1
            x /= 5
        f[i] = f[i - 1] * x % MOD
        p2[i] = p2[i - 1] + e2
        p5[i] = p5[i - 1] + e5
    invF = pow(f[MX], MOD - 2)
    for i in range(MX, 0, -1):
        x = i
        while x & 1 == 0:
            x >>= 1
        while x % 5 == 0:
            x /= 5
        invF[i - 1] = invF[i] * x % MOD


def comb(n, k):
    return (
        f[n]
        * invF[k]
        % MOD
        * invF[n - k]
        % MOD
        * pow(2, p2[n] - p2[k] - p2[n - k])
        % MOD
        * pow(5, p5[n] - p5[k] - p5[n - k])
        % MOD
    )

# permu TBC